Skip to content

Fix repo/path-matching regex - #66

Closed
aadrian wants to merge 4 commits into
gitbucket:masterfrom
aadrian:pr-fix-path-matching
Closed

aadrian wants to merge 4 commits into
gitbucket:masterfrom
aadrian:pr-fix-path-matching

Conversation

@aadrian

@aadrian aadrian commented Sep 17, 2026 •

Copy link
Copy Markdown
Member

Fixes the URL-matching regex so repositories named signin, dashboard, admin or groups work, and anchors it after the servlet context path as suggested in the review. Adds PluginSpec.

Comment thread src/main/scala/Plugin.scala Outdated
val path = settings.baseUrl.getOrElse(context.getContextPath)
Seq(
".*/(?!.*(signin|dashboard|admin)).+/.+" -> s"""
"(?!/(?:signin|dashboard|admin)(?:/|$)).+/.+" -> s"""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the current problem that the explorer plugin doesn't work for repositories that contain /signin, /dashboard and /admin. However, this change could wrongly inject CSS/JavaScript when GitBucket is installed under the context path.

Maybe we should include the context path in the regular expression?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@takezoe the further commit should handle context path too.

There's also an alternative PR , #73 (kind of a "hack" ) since that place is not optimal, however this way no regexp is needed, since it will be inserted only where needed.

However, IMO a better solution would be to allow plug-ins to handle assets better (but that would require some GitHub changes: please see https://github.com/aadrian/gitbucket-explorer-plugin/wiki/Plugin-asset-extension-point

Thank you.

@takezoe

takezoe commented Oct 3, 2026

Copy link
Copy Markdown
Member

@aadrian Can we close this since #73 has been merged?

@aadrian

aadrian commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

@takezoe Yes, superseded by #73, closing.

Longer term, I think a plugin asset extension point in GitBucket core would be the better approach for all plugins. I'd appreciate your thoughts on the proposal: Plugin asset extension point

@aadrian aadrian closed this Oct 3, 2026
@aadrian
aadrian deleted the pr-fix-path-matching branch October 3, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants